package com.domain.service.impl;

import com.domain.common.Result;
import com.domain.dao.FeedBackMapper;
import com.domain.pojo.FeedBack;
import com.domain.service.FeedBackService;
import com.domain.utils.UUIDUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;

@Service
@Transactional(rollbackFor=Exception.class)
public class FeedBackServiceImpl implements FeedBackService {

    @Autowired
    private FeedBackMapper feedBackMapper;

    /**
     * 添加反馈
     *
     * @param userId
     * @param content
     * @return
     */
    @Override
    public Result addFeedBack(String userId, String content) {
        FeedBack feedBack = new FeedBack();
        feedBack.setId(UUIDUtils.getRandomUUID());
        feedBack.setUserId(userId);
        feedBack.setFeedbackContent(content);
        feedBack.setCreatTime(new Date());
        feedBackMapper.insertSelective(feedBack);
        return Result.success("操作成功");
    }
}
